<?php

/**
 * apExternalCMSConfigureForm
 *
 * @package    authpuppy
 * @subpackage plugin
 * @author     Geneviève Bastien <gbastien@versatic.net>
 * @version    $Id: pre-alpha$
 */
class apExternalCMSConfigureForm extends apPluginManagerConfigurationForm
{
  protected $namespace = 'apExternalCMS';
  /**
   * @see sfForm
   */
  public function setup()
  {
    parent::setup();
    $this->widgetSchema['external_url'] = new sfWidgetFormInputText(array(), array('size' => 50));
    $this->validatorSchema['external_url'] = new sfValidatorString(array('required' => false));
    $this->widgetSchema->setHelp("portal_page", 'Base external url where pages will be redirected to.');
    
    $this->widgetSchema['redirect_login_page'] = new sfWidgetFormInputCheckbox(array('value_attribute_value' => 1));
    $this->validatorSchema['redirect_login_page'] = new sfValidatorPass();
    
    $this->widgetSchema['login_page'] = new sfWidgetFormInputText(array(), array('size' => 50));
    $this->validatorSchema['login_page'] = new sfValidatorString(array('required' => false));
    $this->widgetSchema->setHelp("login_page", 'You can use parameters to define this url: possible values: %nodeid%, %gwid%, %nodename%, %friendlyname%, %originurl%, %identitytype%, %identityname%, %getparameters%.  Example: /hotspot/%nodename%?node_id=%nodeid% or /hotspot?%getparameters%');
    
    $this->widgetSchema['redirect_portal_page'] = new sfWidgetFormInputCheckbox(array('value_attribute_value' => 1));
    $this->validatorSchema['redirect_portal_page'] = new sfValidatorPass();
    
    $this->widgetSchema['portal_page'] = new sfWidgetFormInputText(array(), array('size' => 50));
    $this->validatorSchema['portal_page'] = new sfValidatorString(array('required' => false));
    $this->widgetSchema->setHelp("portal_page", 'You can use parameters to define this url: possible values: %nodeid%, %gwid%, %nodename%, %friendlyname%, %originurl%, %identitytype%, %identityname%, %getparameters%.  Example: /hotspot/%nodename% or /hotspot?page=%nodename%');
    
    
    
   
  }
  
 /* public function getPartial() {
    return "apNodeExtra/formConfigure";
  }*/
  
  public function findDefaults() {
    $this->setDefaults(array('external_url' => $this->plugin->getConfigValue('external_url', ''),
                    'portal_page' => $this->plugin->getConfigValue('portal_page', ''),
                    'login_page' => $this->plugin->getConfigValue('login_page', ''),
                    'redirect_portal_page' => $this->plugin->getConfigValue('redirect_portal_page', false),
                    'redirect_login_page' => $this->plugin->getConfigValue('redirect_login_page', false),
                        ));
  }

}